public class LambdaExample {
    public static void main(String[] args) {
        Calculator adder = (int a,int b) ->a + b;
        Calculator subtaractor = (int a,int b) ->a - b;
        Calculator multiplier = (int a,int b) ->a * b;
        Calculator divider = (int a,int b) ->a / b;


        int resultAdd = adder.calculate(5,3);
        System.out.println("使用Lambda表达式实现的加法结果："+ resultAdd);
        int resultSub = subtaractor.calculate(5,3);
        System.out.println("使用Lambda表达式实现的减法结果："+ resultSub);
        int resultMul = multiplier.calculate(5,3);
        System.out.println("使用Lambda表达式实现的乘法结果："+ resultMul);
        int resultDiv = divider.calculate(5,3);
        System.out.println("使用Lambda表达式实现的除法结果："+ resultDiv);





       /* Calculator adder = new Calculator() {
            @Override
            public int calculate(int a, int b) {
                return a + b;

            }
        };
        int result = adder.calculate(5,3);
        System.out.println("使用匿名内部类实现的加法结果："+result);










/*        Calculator adder = new Adder();

        int result = adder.calculate(5,3);
        System.out.println("使用外部类实现的加法效果:"+result);*/
    }
}
